import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HdzbVO, HdzbForm, HdzbQuery } from '@/api/wuliu/hdzb/types';

/**
 * 查询回单主表列表
 * @param query
 * @returns {*}
 */

export const listHdzb = (query?: HdzbQuery): AxiosPromise<HdzbVO[]> => {
  return request({
    url: '/wuliu/hdzb/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询回单主表详细
 * @param id
 */
export const getHdzb = (id: string | number): AxiosPromise<HdzbVO> => {
  return request({
    url: '/wuliu/hdzb/' + id,
    method: 'get'
  });
};

/**
 * 新增回单主表
 * @param data
 */
export const addHdzb = (data: HdzbForm) => {
  return request({
    url: '/wuliu/hdzb',
    method: 'post',
    data: data
  });
};

/**
 * 修改回单主表
 * @param data
 */
export const updateHdzb = (data: HdzbForm) => {
  return request({
    url: '/wuliu/hdzb',
    method: 'put',
    data: data
  });
};

/**
 * 删除回单主表
 * @param id
 */
export const delHdzb = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wuliu/hdzb/' + id,
    method: 'delete'
  });
};
